package com.freak.wanandroid.model.myself.activity.collect;

import com.freak.httpmanager.callback.SubscriberCallBack;
import com.freak.wanandroid.base.repository.BaseRepository;
import com.freak.wanandroid.bean.CollectBean;
import com.freak.wanandroid.net.HttpResultFunc;
import com.freak.wanandroid.util.ToolUtils;

import io.reactivex.rxjava3.core.Observable;


/**
 * Created by 74099 on 2018/8/29.
 */

public class CollectRepository extends BaseRepository {
    public void getCollectList(String curPage,SubscriberCallBack<CollectBean> observer) {
        String page = ToolUtils.subtract(curPage, "1");
        Observable observable = mApiService.getCollect("lg/collect/list/" + page + "/json").map(new HttpResultFunc<CollectBean>());
        addSubscription(observable, observer);
    }

    public void doCollectCancel(int id, int originId,SubscriberCallBack<String> observer) {
        Observable observable = mApiService.doCollectCancel(id,originId).map(new HttpResultFunc<String>());
        addSubscription(observable, observer);
    }
}
